
package com.bootx.service.impl;

import com.bootx.dao.ProductDao;
import com.bootx.entity.Product;
import com.bootx.service.ProductService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

/**
 * @author black
 */
@Service
public class ProductServiceImpl extends BaseServiceImpl<Product, Long> implements ProductService {

    @Resource
    private ProductDao productDao;

    @Override
    public Product create(Product product) {
        Product other = productDao.find("otherUrl", product.getOtherUrl());
        if(other==null){
            return super.save(product);
        }else{
            other.setMemo(product.getMemo());
            return super.update(other);
        }
    }
}